﻿namespace game
{
    class Props  //道具
    {
        public int HealthPotion { get; set; } = 10;

        public void GetHealthPotion()
        {
            Console.WriteLine($"当前剩余药水数量{this.HealthPotion}");

            Random random = new();
            int a, b, c;
            for (int i = 0; i < 5; i++)
            {
                a = random.Next(2, 100);
                b = random.Next(50, 300);
                Console.WriteLine($"请计算{a}+{b}的和为：");
            标签1:
                try
                {
                    c = int.Parse("" + Console.ReadLine());
                }
                catch (Exception)
                {
                    Console.WriteLine("请输入数字");
                    goto 标签1;
                }

                if (a + b == c)
                {
                    Console.WriteLine("正确");
                    Console.WriteLine($"已完成{i}/5");
                }
                else
                {
                    Console.WriteLine("错误，退出此模式");
                    Thread.Sleep(1000);
                    return;
                }
            }
            Console.WriteLine("恭喜，获得生命恢复药水 1 ");
            this.HealthPotion += 1;
        }
    }
}